Boost
boost
arrow_drop_down
Boost.Optional
C++ 03 Added in Boost 1.30.0
Categories: Data

A value-semantic, type-safe wrapper for representing 'optional' (or 'nullable') objects of a given type. An optional object may or may not contain a value of the underlying type.

This Release

Fernando Cacciola
Maintainer
Andrzej Krzemienski
Andrzej Krzemienski
Maintainer

optional

A library for representing optional (nullable) objects in C++.

optional<int> readInt(); // this function may return either an int or a not-an-int

if (optional<int> oi = readInt()) // did I get a real int
  cout << "my int is: " << *oi;   // use my int
else
  cout << "I have no int";

For more information refer to the documentation provided with this library.

All Time

Fernando Cacciola
Fernando Cacciola
Contributor
Josh Soref
Josh Soref
Contributor
Steven Watanabe
Steven Watanabe
Contributor
Beman Dawes
Beman Dawes
Contributor
Daniel James
Daniel James
Contributor
Andrey Semashev
Andrey Semashev
Contributor
nobody
Contributor
Niels Dekker
Contributor
Stephen Kelly
Stephen Kelly
Contributor
Dave Abrahams
Dave Abrahams
Contributor
Troy D. Straszheim
Troy D. Straszheim
Contributor
Douglas Gregor
Douglas Gregor
Contributor
Rene Rivera
Rene Rivera
Contributor
Vladimir Prus
Vladimir Prus
Contributor
Marshall Clow
Marshall Clow
Contributor
jzmaddock
jzmaddock
Contributor
Nikita Kniazev
Nikita Kniazev
Contributor
Peter Dimov
Peter Dimov
Contributor
Peter Dimov
Peter Dimov
Contributor
Matias Capeletto
Matias Capeletto
Contributor
Hartmut Kaiser
Hartmut Kaiser
Contributor
Robert Leahy
Robert Leahy
Contributor
Michael A. Jackson
Michael A. Jackson
Contributor
sdarwin
sdarwin
Contributor
Alexander Grund
Alexander Grund
Contributor
Edward Diener
Edward Diener
Contributor
petamas
petamas
Contributor
Markus Schöpflin
Contributor
Vinnie Falco
Vinnie Falco
Contributor
Gennaro Prota
Contributor
Jens Maurer
Jens Maurer
Contributor
Vicente J. Botet Escriba
Vicente J. Botet Escriba
Contributor
Matt
Matt
Contributor
Jürgen Hunold
Jürgen Hunold
Contributor
Jeremiah Willcock
Jeremiah Willcock
Contributor
Tosiekdev
Tosiekdev
Contributor
Aleksey Gurtovoy
Contributor
Marcel Raad
Marcel Raad
Contributor
akumta
akumta
Contributor
Benjamin Roland Buch
Benjamin Roland Buch
Contributor
drivehappy
drivehappy
Contributor
Kohei Takahashi
Kohei Takahashi
Contributor
Giovanni Mascellani
Giovanni Mascellani
Contributor
Gennadiy Rozental
Gennadiy Rozental
Contributor
Mike Dev
Mike Dev
Contributor
Ralf W. Grosse-Kunstleve
Contributor
Stefan Seefeld
Stefan Seefeld
Contributor
Kazutoshi SATODA
Kazutoshi SATODA
Contributor
Olaf van der Spek
Olaf van der Spek
Contributor
Moritz Baumann
Moritz Baumann
Contributor
Peter Klotz
Contributor
Casey Carter
Casey Carter
Contributor
Sebastian Redl
Contributor
glywk
glywk
Contributor
Fredrik Blomqvist
Contributor
Siddhant Saraf
Siddhant Saraf
Contributor
Tolga HOŞGÖR
Tolga HOŞGÖR
Contributor
Anthony Leedom
Anthony Leedom
Contributor
Anthony
Anthony
Contributor
Daniel Seither
Daniel Seither
Contributor
Daniel J. Hofmann
Daniel J. Hofmann
Contributor
gieseanw
gieseanw
Contributor